﻿
namespace Jayden.Dll.Sc2.Descriptions.Zerg
{
	public class LarvaActionDescription : DelayedActionDescription
	{
		public LarvaActionDescription(EntityDescription entity, long time, string id)
			: base(entity, time, null, id)
		{
			m_Execute = delegate(GameState innerState)
			{
				innerState.Add(entity, -1, 1, 0);
				GameState.EntityState larvaState = innerState[entity];
				if (larvaState.Total < innerState.Bases * 3 && larvaState.Building < innerState.Bases)
				{
					innerState.Add(entity, 1, 0, 1);
					LarvaActionDescription spawnLarva = new LarvaActionDescription(entity, 15 + innerState.Time, "LarvaFinished");
					innerState.Add(spawnLarva);
				}
			};
		}
	}
}
